package algorithm.leecode.combination;

import java.util.LinkedList;
import java.util.List;

class Solution {
    List<List<Integer>>  numbers= new LinkedList<>();
    public List<List<Integer>> combine(int n, int k) {

        int[] digits = new int[n];
         for(int i=0;i<n;i++){
             digits[i] = i+1;
         }

           generationCombine(digits,k,0,new LinkedList<>());
         return numbers;
         }

         public void generationCombine(int[] digits,int k,int start,LinkedList<Integer> list){
           if(list.size()==k){
               numbers.add(new LinkedList<>(list));
               return;
           }
             System.out.println("range："+(digits.length-(k-list.size())+1));
           for(int i  = start;i<digits.length-(k-list.size())+1;i++){
               list.addLast(digits[i]);
               generationCombine(digits,k,i+1,list);
               list.removeLast();
           }

         }
         public static void main(String[] args) {
        Solution solution  = new Solution();
        solution.combine(10,3);
    }


}